package org.example.controller;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term;
import org.example.util.TextComparator;

import java.util.List;

public class test {
    public static void test01() {
        String text1 = "package org.example.controller;\n" +
                "\n" +
                "import com.hankcs.hanlp.HanLP;\n" +
                "import com.hankcs.hanlp.seg.common.Term;\n" +
                "\n" +
                "import java.util.List;\n" +
                "\n" +
                "public class test {\n" +
                "    public static void test01(){\n" +
                "        String text = \"\";\n" +
                "        List<Term> words= HanLP.segment(text);\n" +
                "        for (Term word : words) {\n" +
                "            System.out.print(word.word + \",\");\n" +
                "        }\n" +
                "    }\n" +
                "\n" +
                "    public static void main(String[] args) {\n" +
                "        test01();\n" +
                "    }\n" +
                "\n" +
                "}\n";
        String text2 = "package org.example;\n" +
                "\n" +
                "import org.springframework.boot.SpringApplication;\n" +
                "import org.springframework.boot.autoconfigure.SpringBootApplication;\n" +
                "\n" +
                "@SpringBootApplication\n" +
                "public class Main {\n" +
                "    public static void main(String[] args) {\n" +
                "        SpringApplication.run(Main.class, args);\n" +
                "\n" +
                "    }\n" +
                "}";
        System.out.println(text1);
        String s = text1.replaceAll("\\s+", " ");
        System.out.println(s);

//        Double cosineSimilarity = TextComparator.getCosineSimilarity(text1, text2);
//        System.out.println(cosineSimilarity);
    }

    public static void main(String[] args) {
        test01();
    }

}
